/*
 *  Brno University of Technology
 *
 *  Copyright (C) 2009-2010 by Brno University of Technology and the contributors
 *
 *  Complete list of developers available at our web site:
 *
 *       http://spl.utko.feec.vutbr.cz
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program.  If not, see http://www.gnu.org/licenses/.
 */
package cz.vutbr.feec.utko.ef.individuals;

/**
 * The Class Action.
 */
public abstract class Action {

	/** The value. */
	private Object[] value;
	
	/**
	 * Instantiates a new action.
	 */
	public Action() {
		super();
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#clone()
	 */
	@Override
	public Object clone() throws CloneNotSupportedException {
		return super.clone();
	}

	/**
	 * Gets the symbol image.
	 * 
	 * @return the symbol image
	 */
	public String getSymbolImage() {
		return null;
	}

	
	/**
	 * Get results perform operation and returns its result.
	 * 
	 * @param operands
	 *            the operands
	 * 
	 * @return the result
	 */
	public abstract Object getValue(Object... operands);
	
	/**
	 * Sets the value.
	 * 
	 * @param operands the new value
	 */
	public void setValue(Object... operands) {
		if (this.value == null)
			this.value = new Object[10];
		this.value[0] = operands[0];
	}
	
	/**
	 * Initialize an action. This action is used only by terminals and
	 * initializes terminal value when the chromozome is constructed.
	 */
	public void initialize() {
		throw new RuntimeException("The action '" + this.getClass().getName()
				+ "' assigned to rule does not override class the "
				+ "'initialize' method. It is required for terminal "
				+ "initialization.");
	}

}